<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            margin: 0;
            padding: 0;
        }

        #hd {
            height: 50px;
            background: #666;
            text-align: center;
        }

        #bd {
            /*左右栏通过添加负的margin放到正确的位置了，此段代码是为了摆正中间栏的位置*/
            padding: 0 200px 0 300px;
            height: 100px;
        }

        #middle {
            float: left;
            width: 100%;
            /*左栏上去到第一行*/
            height: 100px;
            background: blue;
        }

        #left {
            float: left;
            width: 300px;
            height: 100px;
            margin-left: -100%;
            background: #0c9;
            /*中间栏的位置摆正之后，左栏的位置也相应右移，通过相对定位的left恢复到正确位置*/
            position: relative;
            left: -300px;
        }

        #right {
            float: left;
            width: 200px;
            height: 100px;
            margin-left: -200px;
            /*中间栏的位置摆正之后，右栏的位置也相应左移，通过相对定位的right恢复到正确位置*/
            position: relative;
            right: -200px;
            background: #0c9;
        }

        #footer {
            height: 50px;
            background: #666;
            text-align: center;
        }
    </style>
</head>

<body>
    <div id="hd">header</div>
    <div id="bd">
        <div id="middle">middle</div>
        <div id="left">left</div>
        <div id="right">right</div>
    </div>
    <div id="footer">footer</div>
</body>

</html>

<!-- <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        header {
            height: 200px;
            background-color: honeydew;
        }

        div {
            padding: 0 100px 0;
        }

        .center {
            width: 100%;
            background-color: hotpink;
        }

        .left {
            margin-left: -100%;
            right: 100px;
            width: 100px;
            position: relative;
            background-color:powderblue;
        }
        
        .right {
            margin-right: -100px;
            width: 100px;
            background-color: lightcoral;
        }

        footer {
            height: 200px;
            background-color: orangered;
        }
    </style>
</head>
<body>
    <header>head</header>
    <div>
        <section class="center">center</section>
        <section class="left">left</section>
        <section class="right">right</section>
    </div>
    <footer>footer</footer>
</body>
</html> -->